package com.godGuang.payment.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
@Component
public class AliPayConfig {
    @Bean
    public AlipayClient initAlipayClient(AlipayConfigProperties alipayConfigProperties) {
        return new
                DefaultAlipayClient(
                alipayConfigProperties.getGatewayUrl(),
                alipayConfigProperties.getAppId(),
                alipayConfigProperties.getMerchantPrivateKey(),
                "json", alipayConfigProperties.getCharset(),
                alipayConfigProperties.getAlipayPublicKey(),
                alipayConfigProperties.getSignType());
    }
}
